/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-05-04 09:50:21
 * @LastEditTime : 2023-06-30 09:38:19
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\FirstLevel\CameraLineList.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { MoreActionsButton } from '../Common/options'
import { ProjectList } from '../Common/Conversion'
const { hostname } = window.location

export const CameraLineList = async ({ url, OptionsEvent, ClientData, Permission, actionRef }) => {
    let data = {
        pageSize: 10,
        params: { pageIndex: 1 },
        get: API_LIST()[`getCameraLineList`],
        options: [
            <MoreActionsButton
                title="更多操作"
                type="primary"
                data={{
                    actionRef,
                    OptionsEvent,
                    CameraStatus: { type: 'ExecuteButton', url: 'posCameraStatusSync', tips: '同步在线状态' },
                    CameraCloudSync: { type: 'ExecuteButton', url: 'posCameraCloudSync', tips: '同步萤石云状态' },
                }}
                items={[
                    { key: 'CameraCloudSync', label: '同步摄像头到萤石云' },
                    { key: 'CameraStatus', label: '同步在线状态' },
                ]}
            />,
        ],
        columns: [
            commonTableList.uuid,
            {
                ...commonTableList.projectUuid,
                valueEnum: await ProjectList(),
                hideInAdded: true,
                hideInModify: true,
                hideInTable: !hostname.includes('jszx'),
                hideInSearch: !hostname.includes('jszx'),
            },
            {
                dataIndex: 'IsCheckbox',
                title: '汇总信息',
                valueType: 'checkbox',
                valueEnum: {
                    IsOrganizationUuid: '机构',
                    IsCameraPositionUuid: '位置',
                    IsCameraTypeUuid: '类型',
                },
                hideInTable: true,
            },

            {
                dataIndex: 'organizationName',
                title: '组织机构',
                valueType: 'input',
                hideInSearch: true,
                ellipsis: true,
                width: 200,
            },
            {
                dataIndex: 'cameraPositionName',
                title: '监控位置',
                valueType: 'input',
                hideInSearch: true,
                ellipsis: true,
                width: 200,
            },
            {
                dataIndex: 'cameraTypeName',
                title: '监控类型',
                valueType: 'input',
                hideInSearch: true,
                ellipsis: true,
                width: 200,
            },
            {
                dataIndex: 'onlineCount',
                hideInSearch: true,
                title: '在线数量',
                valueType: 'input',
                ellipsis: true,
                width: 150,
            },
            {
                dataIndex: 'offlineCount',
                hideInSearch: true,
                title: '离线数量',
                valueType: 'input',
                ellipsis: true,
                width: 150,
            },
            {
                dataIndex: 'totalCount',
                hideInSearch: true,
                title: '总计数量',
                valueType: 'input',
                ellipsis: true,
                width: 150,
            },
        ],
    }

    return data
}
